package com.xxcxcxcx.jobsystem.common.inits;

import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.ArgumentType;
import com.xxcxcxcx.jobsystem.common.command.LevelCommand;
import com.xxcxcxcx.jobsystem.common.command.argumets.JobArgument;
import com.xxcxcxcx.jobsystem.common.command.argumets.JobParameterArgument;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.arguments.coordinates.Vec3Argument;
import net.minecraft.commands.synchronization.ArgumentTypes;
import net.minecraft.commands.synchronization.EmptyArgumentSerializer;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber
public class CommandInit {
    @SubscribeEvent
    public static void onServerStaring(RegisterCommandsEvent event) {
        CommandDispatcher<CommandSourceStack> dispatcher = event.getDispatcher();
        LevelCommand.register(dispatcher);
    }

    public static void registerArgumentTypes() {
        ArgumentTypes.register("job", JobArgument.class, new EmptyArgumentSerializer<>(JobArgument::job));
        ArgumentTypes.register("job_parameter", JobParameterArgument.class, new EmptyArgumentSerializer<>(JobParameterArgument::jobParameter));
    }
}